<%@page import="org.apache.struts2.components.Include"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>订单发货信息</title>
	<link rel="stylesheet" href="css/bootstrap.css"></link>
	<link rel="stylesheet" href="css/style.css"></link>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery.easydropdown.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<style>
		.men fieldset{
			margin:2% 10% 3% 10%
		}
		.price_show div{
			display:inline-block
		}
	</style>
  </head>
  
  <body>
  <%@include file="common/head.jsp"%>
  <div class="menu">
	</div>
    <div class="men">
    	<fieldset>
    		<legend>订单发货信息</legend>
    		<table>
	    		<tr><td>下单时间:&nbsp;&nbsp;</td><td>${orders.creDate}</td><td>&nbsp;&nbsp;&nbsp;</td><td>单号:&nbsp;&nbsp;</td><td>${orders.num}</td></tr>
	    	</table>
    		<fieldset>
		    	<legend>商品详情</legend>
		    	<table>
		    		<s:iterator value="orderGoodsList" id="ordergoods">
		    			<tr><td>${ordergoods.name}</td><td>&nbsp;&nbsp;&nbsp;</td><td>￥${ordergoods.price} x ${ordergoods.amount}</td></tr>
		    			<tr><td colspan="3"></td></tr>
		    		</s:iterator>
		    		<%--<tr><td>商品名</td><td>${order.newOrderGood.goodsname}</td></tr>
		    		<tr><td>描述</td><td>${session.newOrderGood.remark}</td></tr>
		    		<tr><td>商家</td><td>${session.newOrderGood.user.username}</td></tr>
		    		<tr><td>价格</td><td>${session.newOrderGood.price}元</td></tr>
		    		<tr><td>数量</td><td>${session.goodAmount}</td></tr>
		    	--%></table>
		    </fieldset>
		    <fieldset>
		    	<legend>收货人信息</legend>
		    	<form name="receiverInfo" action="sendTheOrder.action" method="post">
		    		<input type="hidden" value="${orders.num}" name="newOrder.num"/>
			    	<table>
			    		<tr height="50px">
			    			<td width="30%">收件人</td>
			    			<td><input type="text" name="newOrder.receiver" id="receiver" value="${orders.receiver}" readonly="readonly"/>
							<span class="redstar">*</span></td>
						</tr>
			    		<tr height="50px"><td>地址</td>
						<td><!-- 配合插件使用的隐藏域 -->
							<input type="hidden" name="newOrder.address" id="address" value="${orders.address}" readonly="readonly"/>
							<span id="addressList">
								<select id="province" disabled="disabled"></select> 
								<select id="city" disabled="disabled"></select>
								<select id="district" disabled="disabled"></select>
								<span class="redstar">*</span>
							</span>
						</td>
						</tr>
						<tr height="50px">
							<td width="30%">详细地址</td>
							<td><input type="text" id="street" readonly="readonly"><span class="redstar">*</span></td>
						</tr>
			    		<tr height="50px">
				    		<td>手机/电话号码</td>
				    		<td><input type="text" name="newOrder.phone" id="phone" value="${orders.phone}" readonly="readonly"/><span class="redstar">*</span></td>
			    		</tr>
			    	</table>
		    	</form>
		    </fieldset>
		    
		    <div class="price_show" style="float:right;width:300px;">
		    	<input type="button" class="btn_form form input" value="确认无误, 发货" onclick="confirmSend()"/>
		    </div>
    	</fieldset>
	    
    </div>
	<script type="text/javascript">
		/* 初始化地址和处理地址格式下拉框的js */
		var addressId = "address";
		var selectId = "addressList";
		/* 控制下拉js 结束 */
		
		function confirmSend() {
			var address = getFormatAddress("province", "city", "district", "street");
			var phone = $("#phone").val();
			var receiver = $("#receiver").val();
			var province = $("#province").val();
			var city = $("#city").val();
			var street = $("#street").val();
			if (receiver.length<1||receiver.length>32) {
				alert("请输入不超过32字符的收件人");
				document.getElementById("receiver").focus();
				return false;
			}
			if (province.length<1) {
				alert("请输入收件省份");
				return false;
			}
			if (city.length<1) {
				alert("请输入收件城市");
				return false;
			}
			if (street.length<1||street.length>64) {
				alert("请输入不超过64位的收件详细地址");
				return false;
			}
			if (phone.length<1) {
				alert("请输入联系电话");
				document.getElementById("phone").focus();
				return false;
			}
			if (address == "" || phone == "" || receiver == ""||province == ""||city == ""||street == "") {
				alert("请填写完整收货人信息!");
			} else {
				$("form").submit();
			}

		}
	</script>
	<!-- 导入加载地址下拉栏所需js文件-->
	<script src="myAddress/js/distpicker.js" charset="utf-8"></script>
	<!-- 导入初始化地址和处理地址格式所需js文件-->
	<script src="myAddress/js/myAddress.js" charset="utf-8"></script>
	<%@include file="common/footer.jsp"%>
  </body>
</html>
